<html>
<head><meta charset="utf-8"><title>s#&quot;Hello&quot; · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html">s#&quot;Hello&quot;</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="195894583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195894583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kennytm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195894583">(Apr 30 2020 at 20:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/213817-t-lang/topic/Making.20new.20.60_.23.60.20prefixes.20not.20a.20breaking.20change/near/195893797" title="#narrow/stream/213817-t-lang/topic/Making.20new.20.60_.23.60.20prefixes.20not.20a.20breaking.20change/near/195893797">said</a>:<br>
in this case literals that take the structure of <code>String</code> rather than <code>&amp;'static str</code></p>
<p>i don't follow, <code>"Hello"s</code> currently produces a "suffixes on a string literal are invalid" error and there's so "structure" at parse time for the literal "Hello". i don't see a difference of playground-ness between <code>"Hello"s</code> and <code>s#"Hello"</code></p>



<a name="195894891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195894891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195894891">(Apr 30 2020 at 20:11)</a>:</h4>
<p>look, I'm just trying to infer what <span class="user-mention" data-user-id="125270">@scottmcm</span> might have meant when they were saying ''' <code>s"Hello"</code> for Strings ''', and I'm basing it on old conversations where people complains that they could not write a literal expression that evaluated to a <code>String</code> value</p>



<a name="195894958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195894958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195894958">(Apr 30 2020 at 20:12)</a>:</h4>
<p>people in the past complained about having to do <code>"foo".into&lt;String&gt;()</code> or whatever</p>



<a name="195895059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195895059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195895059">(Apr 30 2020 at 20:13)</a>:</h4>
<p>/me once again is faced with the reality that they in fact <em>cannot</em> read minds</p>



<a name="195898465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195898465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195898465">(Apr 30 2020 at 20:42)</a>:</h4>
<p>I agree that <code>"Hello"s</code> breaks at lex time.  Here's the thing that doesn't;</p>
<div class="codehilite"><pre><span></span><code>macro_rules! demo {
    ($i:ident # $e:literal ) =&gt; {
        ()
    }
}

fn main() {
    demo!(s#&quot;hello&quot;);
}
</code></pre></div>


<p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=f3fa43180f4b61d04a54df78faaaf1c8" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=f3fa43180f4b61d04a54df78faaaf1c8">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=f3fa43180f4b61d04a54df78faaaf1c8</a></p>



<a name="195898582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195898582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195898582">(Apr 30 2020 at 20:43)</a>:</h4>
<p>You can do similar things with <code>b"Hello"</code> (one token) vs <code>g"Hello"</code> (two tokens)</p>



<a name="195898768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195898768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195898768">(Apr 30 2020 at 20:44)</a>:</h4>
<p>So in order to have a prefix marker for <code>String</code> instead of <code>&amp;str</code> -- like we have for getting <code>[u8; N]</code> instead of <code>&amp;str</code> -- then it's a breaking change unless we reserve lexical space</p>



<a name="195898996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195898996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195898996">(Apr 30 2020 at 20:46)</a>:</h4>
<p>Oh, <code>s"Hello": String</code> would be awesome! Can we do this over an edition?</p>



<a name="195899085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899085">(Apr 30 2020 at 20:47)</a>:</h4>
<p>Yes, as far as I know, since it's frontend-only.</p>



<a name="195899187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kennytm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899187">(Apr 30 2020 at 20:47)</a>:</h4>
<p>a prefix marker would conflict with raw strings though, unlike <code>r"2 \ge 1"s</code>.</p>



<a name="195899294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kennytm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899294">(Apr 30 2020 at 20:48)</a>:</h4>
<p>(you could make it <code>sr"2 \ge 1"</code> for sure)</p>



<a name="195899352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899352">(Apr 30 2020 at 20:49)</a>:</h4>
<p>What does the <code>r</code> mean? is that already rust syntax?</p>



<a name="195899368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kennytm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899368">(Apr 30 2020 at 20:49)</a>:</h4>
<p>yes</p>



<a name="195899418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kennytm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899418">(Apr 30 2020 at 20:49)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">dbg</span><span class="o">!</span><span class="p">(</span><span class="s">r&quot;2 \ge 1&quot;</span><span class="p">);</span><span class="w"> </span><span class="c1">// [src/main.rs:2] r&quot;2 \ge 1&quot; = &quot;2 \\ge 1&quot;</span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="195899508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899508">(Apr 30 2020 at 20:50)</a>:</h4>
<p>lol, I already knew that <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="195899513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899513">(Apr 30 2020 at 20:50)</a>:</h4>
<p>Part of what I've been confused about in this conversation is that the <code>s</code> suffix on <span class="user-mention" data-user-id="125254">@kennytm</span> 's examples is not a typo nor a plural; its the whole point they are making</p>



<a name="195899527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899527">(Apr 30 2020 at 20:50)</a>:</h4>
<p>I don't think a prefix marker conflicts if it's language syntax, since there's already <code>br##"hello"##</code></p>



<a name="195899558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899558">(Apr 30 2020 at 20:50)</a>:</h4>
<p>i.e. a suffix marker</p>



<a name="195899572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899572">(Apr 30 2020 at 20:50)</a>:</h4>
<p>So <code>sr#"hello"#</code> would also work</p>



<a name="195899683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kennytm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899683">(Apr 30 2020 at 20:51)</a>:</h4>
<p>yes. (one disadvantage is that the plain prefix can't end with <code>r</code> <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span>)</p>



<a name="195899689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899689">(Apr 30 2020 at 20:51)</a>:</h4>
<p>Now, if the idea was that suffixes would be a new extensability point -- like C++'s custom literals -- then something that's not a prefix might be better, i agree</p>



<a name="195899705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899705">(Apr 30 2020 at 20:51)</a>:</h4>
<p><code>s##"hello to all the #as#es "##</code> would work as well, right?</p>



<a name="195899769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899769">(Apr 30 2020 at 20:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="198054">mark-i-m</span> <a href="#narrow/stream/213817-t-lang/topic/s.23.22Hello.22/near/195899352" title="#narrow/stream/213817-t-lang/topic/s.23.22Hello.22/near/195899352">said</a>:</p>
<blockquote>
<p>What does the <code>r</code> mean? is that already rust syntax?</p>
</blockquote>
<p>We started out with raw string syntax, for <code>r#"foo"#</code>, and then we introduced raw identifier syntax using <code>r#not_a_keyword</code> (which didn't conflict because it doesn't start with <code>r#"</code>), and now we're thinking about using the same lexing space for "raw language constructs, without surface syntax", using <code>r#$something</code>, which again wouldn't conflict with anything that lexes today.</p>



<a name="195899796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899796">(Apr 30 2020 at 20:52)</a>:</h4>
<p>Ah, hmm. Yes, I see the point now.</p>



<a name="195899805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899805">(Apr 30 2020 at 20:52)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> I don't know -- does <code>b##"hello to all the #as#es "##</code> work?  I thought it needed the <code>r</code></p>



<a name="195899844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899844">(Apr 30 2020 at 20:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/213817-t-lang/topic/s.23.22Hello.22/near/195899705" title="#narrow/stream/213817-t-lang/topic/s.23.22Hello.22/near/195899705">said</a>:</p>
<blockquote>
<p><code>s##"hello to all the #as#es "##</code> would work as well, right?</p>
</blockquote>
<p>(assuming we went with scott's suggestion that we should eagerly reserve <code>&lt;ident&gt;</code> <code>#</code> <code>&lt;stuff&gt;</code>)</p>



<a name="195899875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899875">(Apr 30 2020 at 20:53)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> hmm I guess I was just assuming that was "simply a matter of engineering"</p>



<a name="195899987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195899987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195899987">(Apr 30 2020 at 20:54)</a>:</h4>
<p>/me is sad that they forgot to write their message as the more simply put <code>s##"#ello"##</code></p>



<a name="195900000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s%23%22Hello%22/near/195900000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s.23.22Hello.22.html#195900000">(Apr 30 2020 at 20:54)</a>:</h4>
<p>Fair point.  I guess I'm mixing "would it be reserved" vs "is that how we'd do it", which are different questions.</p>
<p>Agreed that that would be reserved.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>